// private, protected, public 访问类型
// public 允许我在类的内外被调用
// private 只允许在类内被使用
// protected 允许在类内及继承的子类中使用
class Person13_1 {
  public name: string;
  public sayHi() {
    this.name;
    console.log("hi");
  }
  private sayABC() {
    this.name;
  }
}

class Teacher13_1 extends Person13_1 {
  public sayBye() {
    this.sayHi();
  }
}

const person13_1 = new Person13_1();
person13_1.name = "dell";
console.log(person13_1.name);
person13_1.sayHi();

// constructor;
class Person13_2 {
  // 传统写法
  // public name: string;
  // constructor(name: string) {
  //   this.name = name;
  // }

  // 简化写法，使用 constructor 进行初始化赋值
  constructor(public name: string) {}
}
const person13_2 = new Person13_2("dell");
console.log(person13_2.name);

// 简写 constructor
class Person13_3 {
  constructor(public name: string) {}
}

class Teacher13_2 extends Person13_3 {
  constructor(public age: number) {
    // super 是调用父类的 constructor
    super("dell");
  }
}

const teacher13_2 = new Teacher13_2(28);
console.log(teacher13_2.age);
console.log(teacher13_2.name);
